package com.autumn.zero.workflow.entitys;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Table;

import org.apache.ibatis.type.JdbcType;
import org.hibernate.validator.constraints.Length;

import com.autumn.constants.SettingConstants;
import com.autumn.mybatis.mapper.annotation.ColumnOrder;
import com.autumn.mybatis.mapper.annotation.ColumnType;
import com.autumn.mybatis.mapper.annotation.Index;

/**
 * 用户完成的任务
 * 
 * @author 杨昌国 2018-12-21 15:25:45
 */
@Table(name = SettingConstants.SYS_TABLE_PREFIX + "_workflow_user_task_complete")
public class WorkflowUserTaskComplete extends AbstractWorkflowUserTask {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3525123038880510001L;
	
	/**
	 * 字段 userName
	 */
	public static final String FILED_USER_NAME = "userName";

	/**
	 * 字段 completeTime
	 */
	public static final String FILED_COMPLETE_TIME = "completeTime";

	/**
	 * 字段 taskResult
	 */
	public static final String FILED_TASK_RESULT = "taskResult";

	/**
	 * 字段 taskOpinion
	 */
	public static final String FILED_TASK_OPINION = "taskOpinion";
	
	/**
	 * taskOpinion 最大长度
	 */
	public static final int MAX_TASK_OPINION_LENGTH = 255;
	
	/**
	 * userName 最大长度
	 */
	public static final int MAX_USER_NAME_LENGTH = 100;
	
	/**
	 * 用户名称
	 */
	@Length(max = MAX_USER_NAME_LENGTH, message = "用户名称长度不能超过" + MAX_USER_NAME_LENGTH + "个字。")
	@Column(name = "user_name", nullable = false, length = MAX_USER_NAME_LENGTH)
	@ColumnType(jdbcType = JdbcType.VARCHAR)
	@ColumnOrder(2)
	@Index
	private String userName;

	/**
	 * 完成时间
	 */
	@Column(name = "complete_time", nullable = false)
	@ColumnOrder(20)
	private Date completeTime;

	/**
	 * 任务结果 {@link com.autumn.zero.workflow.constants.ProcessTaskConstants}
	 */
	@Column(name = "task_result", nullable = false)
	@ColumnOrder(21)
	private Integer taskResult;

	/**
	 * 任务意见
	 */
	@Length(max = MAX_TASK_OPINION_LENGTH, message = "任务意见长度不能超过" + MAX_TASK_OPINION_LENGTH + "个字。")
	@Column(name = "task_opinion", nullable = false, length = MAX_TASK_OPINION_LENGTH)
	@ColumnType(jdbcType = JdbcType.VARCHAR)
	@ColumnOrder(22)
	private String taskOpinion;
	
	/**
	 * 获取用户名称
	 * 
	 * @return
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * 设置用户名称
	 * 
	 * @param userName
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * 获取完成时间
	 * 
	 * @return
	 */
	public Date getCompleteTime() {
		return completeTime;
	}

	/**
	 * 设置完成时间
	 * 
	 * @param completeTime 完成时间
	 */
	public void setCompleteTime(Date completeTime) {
		this.completeTime = completeTime;
	}

	/**
	 * 获取任务结果
	 * 
	 * @return {@link com.autumn.zero.workflow.constants.ProcessTaskConstants}
	 */
	public Integer getTaskResult() {
		return taskResult;
	}

	/**
	 * 设置任务结果
	 * 
	 * @param taskResult 任务结果 {@link com.autumn.zero.workflow.constants.ProcessTaskConstants}
	 */
	public void setTaskResult(Integer taskResult) {
		this.taskResult = taskResult;
	}

	/**
	 * 获取任务意见
	 * 
	 * @return
	 */
	public String getTaskOpinion() {
		return taskOpinion;
	}

	/**
	 * 设置任务意见
	 * 
	 * @param taskOpinion
	 */
	public void setTaskOpinion(String taskOpinion) {
		this.taskOpinion = taskOpinion;
	}
}
